#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  long long anser = 0;
  cin >> N >> M;
  vector<long long> s(M, 0), c(M, 0), d(N);
  for (long long i = 0; i < (long long)1000; i++) {
    int keta = 1;
    int nx = i / 10;
    while (nx) {
      keta++;
      d.push_back(nx % 10);
      nx /= 10;
    }
    if (keta != N) continue;
    bool ok = true;
    reverse(d.begin(), d.end());
    for (long long j = 0; j < (long long)M; j++) {
      if (d[s[j] - 1] != c[j]) ok = false;
    }
    if (ok) {
      cout << i << endl;
      return 0;
    }
  }
  cout << "-1" << endl;
  return 0;
}
