#include <bits/stdc++.h>
using namespace std;
int can(int m, int s) {
  if (s >= 0 && s <= 9 * m) {
    return 1;
  }
  return 0;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  int flag = 0;
  int tmp = 0;
  int m = 0;
  int s = 0;
  cin >> m >> s;
  if (m == 1) {
    if (s >= 0 && s <= 9) {
      cout << s << " " << s << endl;
    } else {
      cout << "-1 -1" << endl;
    }
    return 0;
  }
  if (!(s >= 1 && s <= 9 * m)) {
    cout << "-1 -1" << endl;
    return 0;
  }
  tmp = s;
  for (int i = 0; i < m; i++) {
    int x = 0;
    if (i == 0) {
      x = 1;
    }
    for (int d = x; d <= 9; d++) {
      if (can(m - i - 1, s - d)) {
        cout << d;
        s = s - d;
        break;
      }
    }
  }
  cout << " ";
  s = tmp;
  for (int i = 0; i < m; i++) {
    int x = 0;
    if (i == 0) {
      x = 1;
    }
    for (int d = 9; d >= x; d--) {
      if (can(m - i - 1, s - d)) {
        cout << d;
        s = s - d;
        break;
      }
    }
  }
  return 0;
}
