#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int s[m], c[m];
  for (int i = 0; i < (int)pow(10, n); i++) {
    string a = to_string(i);
    if (a.size() < n) continue;
    for (int i = 0; i < (int)(m); i++) {
      if ((int)(a[s[i]] - '0') != c[i]) continue;
    }
    cout << a << endl;
    return 0;
  }
  cout << "-1\n";
}
