#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, n, s;
  cin >> n >> s;
  if (n == 1 && s == 0)
    cout << "0 0" << endl;
  else if (s >= 1 && s <= n * 9) {
    int ss = s;
    int nn = n;
    if (s - (n - 1) * 9 <= 1) {
      cout << "1";
      s--;
    } else {
      cout << s - (n - 1) * 9;
      s -= (s - (n - 1) * 9);
    }
    n--;
    while (n--) {
      if (s <= (n)*9)
        cout << "0";
      else {
        cout << s - (n)*9;
        s = s - (s - (n)*9);
      }
    }
    cout << " ";
    while (nn--) {
      if (ss == 0)
        cout << "0";
      else {
        if (ss >= 9) {
          cout << "9";
          ss -= 9;
        } else {
          cout << ss;
          ss = 0;
        }
      }
    }
  } else
    cout << "-1 -1" << endl;
  return 0;
}
