#include <bits/stdc++.h>
using namespace std;
int main() {
  int d, s;
  cin >> d >> s;
  if (d == 0 || (s == 0 && d > 1) || d * 9 < s) {
    cout << "-1"
         << " "
         << "-1" << endl;
    return 0;
  }
  if (d == 1 && s == 0) {
    cout << "0"
         << " "
         << "0" << endl;
    return 0;
  }
  vector<int> mn(d), mx(d);
  int j = d - 1, sn = 0, sm = 0;
  mx[0] = 1;
  mn[0] = 1;
  for (int i = 0;; i++) {
    for (int k = 0; k < d; k++) {
      sn += mn[k];
    }
    if (sn != s) {
      mn[j]++;
    } else {
      break;
    }
    if (mn[j] == 9) j--;
    sn = 0;
  }
  j = 0;
  for (int i = 0;; i++) {
    for (int k = 0; k < d; k++) {
      sm += mx[k];
    }
    if (sm != s) {
      mx[j]++;
    } else {
      break;
    }
    if (mx[j] == 9) j++;
    sm = 0;
  }
  for (auto i : mn) cout << i;
  cout << " ";
  for (auto i : mx) cout << i;
  cout << endl;
}
