#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
// #ifndef ONLINE_JUDGE
// freopen("in.txt", "r", stdin);
// #endif
ios_base::sync_with_stdio(0);
cin.tie(0);
string a, b; cin >> a >> b;
string s1 = a, s2 = b;
int i1 = 0, j1 = b.size() / 2;
int i2 = a.size() / 2, j2 = 0;
while(true){
if(i1 == s1.size() / 2)
break;
if(i2 == s2.size())
break;
s1[i1] = b[j1]; i1++; j1++;
s2[i2] = a[j2]; i2++; j2++;
}
if(s1 == s2)
cout << s1;
else
cout << -1;
return 0;
}