#include <bits/stdc++.h>
using namespace std;
bool can(int m, int s) { return s >= 0 && s <= 9 * m; }
bool can1(int m, int s) {
  if (m == 1) return s >= 0 && s <= 9 * m;
  return s > 0 && s <= 9 * m;
}
int main() {
  int m, s;
  cin >> m;
  cin >> s;
  string minn;
  string max;
  int sum1 = s;
  int sum = s;
  for (int i = 0; i < m; i++) {
    for (int d = 0; d < 10; d++) {
      if ((i > 0 || d > 0 || (m == 1 && d == 0)) && can(m - i - 1, sum - d)) {
        minn += char('0' + d);
        sum -= d;
        break;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    for (int d = 9; d >= 0; d--) {
      if ((i > 0 || d > 0 || (m == 1 && d == 0)) && can(m - i - 1, sum1 - d)) {
        max += char('0' + d);
        sum1 -= d;
        break;
      }
    }
  }
  if (!can1(m, s)) {
    minn = "-1";
    max = "-1";
  }
  cout << minn << endl;
  cout << max;
  return 0;
}
