#include <bits/stdc++.h>
using namespace std;
int main() {
  string ch, t;
  int n, s, i;
  bool ok1 = 0, ok2 = 0;
  scanf("%d %d", &n, &s);
  if (9 * n >= s) {
    if (n == 1 && s == 0) {
      cout << 0 << " " << 0 << endl;
    } else if (s == 0) {
      cout << -1 << " " << -1 << endl;
    } else {
      while (n--) {
        ch += min(9, s) + '0';
        t = ch;
        s -= 9;
        if (s < 0) s = 0;
      }
      reverse(t.begin(), t.end());
      if (t[0] == '0') {
        t[0] = '1';
        for (i = 1; i < t.size(); i++) {
          if (t[i] > '0') {
            t[i] = t[i] - 1;
            break;
          }
        }
      }
      cout << t << " " << ch << endl;
    }
  } else {
    cout << -1 << " " << -1 << endl;
  }
  return 0;
}
