#include <bits/stdc++.h>
using namespace std;
int main() {
  int d, s, j, sum = 0;
  int arr[111];
  cin >> d >> s;
  if (s == 0 && d == 1) {
    cout << 0 << " " << 0 << endl;
    return 0;
  }
  if (s >= 0 && 9 * d >= s) {
    if (s == 0) {
      cout << -1 << " " << -1 << endl;
      return 0;
    }
    for (int i = 1; i <= d; i++) {
      if (i == 1)
        j = 1;
      else
        j = 0;
      for (; j < 10; j++) {
        if (sum + (d - i) * 9 + j >= s) {
          arr[i] = j;
          sum += j;
          break;
        }
      }
    }
    for (int i = 1; i <= d; i++) {
      cout << arr[i];
    }
    cout << " ";
    int n;
    sum = 0;
    for (int i = 1; i <= d; i++) {
      for (j = 9; j >= 0; j--) {
        if (sum + j <= s) {
          arr[i] = j;
          sum += j;
          break;
        }
      }
    }
    for (int i = 1; i <= d; i++) {
      cout << arr[i];
    }
    cout << endl;
  } else {
    cout << -1 << " " << -1 << endl;
  }
  return 0;
}
