#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, s, i, a, b;
  cin >> m >> s;
  if (s > 9 * m || s == 0) {
    if (m == 1 && s == 0)
      cout << "0 0" << endl;
    else
      cout << "-1 -1" << endl;
    return 0;
  } else {
    if (s < 9 * m - 8) {
      cout << 1;
      a = m - 1;
      b = s - 1;
      for (i = a; i > 0; i--) {
        if (b - 9 * i + 9 > 0) {
          cout << b - 9 * i + 9;
          b -= b - 9 * i + 9;
        } else
          cout << 0;
      }
    } else {
      cout << s - 9 * m + 9;
      for (i = m - 1; i > 0; i--) cout << 9;
    }
    cout << ' ';
    b = s;
    for (i = m; i > 0; i--) {
      if (b > 9) {
        cout << 9;
        b -= 9;
      } else {
        cout << b;
        b = 0;
      }
    }
  }
  return 0;
}
