#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum;
  cin >> n >> sum;
  if (n == 0 || (sum == 0 && n > 1))
    cout << "-1"
         << " "
         << "-1" << endl;
  else {
    int ma;
    string t = "";
    int x = sum;
    while (x > 0 && t.length() != n) {
      if ((x - 9) >= 0) {
        t = t + '9';
        x = x - 9;
      } else {
        char c = x + '0';
        t = t + c;
        x = 0;
      }
    }
    if (t.length() == n && x != 0)
      cout << "-1"
           << " "
           << "-1" << endl;
    else {
      int ctr = 0;
      int x = (n - t.length());
      if (t.length() != n) {
        for (int i = 1; i <= x; i++) {
          t = t + '0';
        }
      }
      int a[t.length()];
      for (int i = 0; i < t.length(); i++) a[i] = ((int)t[i] - 48);
      int flag = 0;
      for (int i = t.length() - 1; i >= 0; i--) {
        if (t[t.length() - 1] == '0' && t.length() != 1) {
          t[t.length() - 1] = '1';
          flag = 1;
        }
        if (flag == 0) break;
        if (t[i] != '0' && i != t.length() - 1 && flag) {
          int r = (int)t[i] - 48;
          r = r - 1;
          char c = r + '0';
          t[i] = c;
          break;
        }
      }
      int y[t.length()];
      for (int i = t.length() - 1; i >= 0; i--) {
        y[i] = (t[i] - '0');
      }
      for (int i = t.length() - 1; i >= 0; i--) cout << y[i];
      cout << " ";
      for (int i = 0; i < t.length(); i++) cout << a[i];
    }
  }
}
