#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (m == 0) {
    if (n == 1)
      return printf("0 0\n"), 0;
    else
      return printf("-1 -1\n"), 0;
  }
  if (m > 9 * n) return printf("-1 -1\n"), 0;
  int mm = m;
  string ans;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 10; j++) {
      if (!i && !j) continue;
      int t = mm - j;
      if (0 <= t && t <= (n - i - 1) * 9) {
        ans = ans + (char)('0' + j);
        mm = t;
        break;
      }
    }
  }
  string res;
  for (int i = 0; i < n; i++) {
    for (int j = 9; j >= 0; j--) {
      if (!i && !j) continue;
      int t = m - j;
      if (0 <= t && t <= (n - i - 1) * 9) {
        res = res + (char)('0' + j);
        m = t;
        break;
      }
    }
  }
  cout << ans << " " << res << endl;
  return 0;
}
