#include <bits/stdc++.h>
using namespace std;
vector<string> solve(int m, int s) {
  vector<string> answer(2);
  int cntr = s;
  if ((long long)9 * m < (long long)s || (s == 0 && m != 1)) {
    answer[0] = "-1";
    answer[1] = "-1";
    return answer;
  }
  vector<int> min_num(m, 0);
  if (m > 1) {
    min_num[0] = 1;
    cntr--;
  }
  for (int i = m - 1; i >= 0; i--) {
    while (cntr > 0 && min_num[i] + 1 < 10) {
      cntr--;
      min_num[i] += 1;
    }
  }
  for (int j = 0; j < m; j++) {
    answer[0] += to_string(min_num[j]);
  }
  cntr = s;
  vector<int> max_num(m, 0);
  if (m > 1) {
    max_num[0] = 1;
    cntr--;
  }
  for (int i = 0; i < m; i++) {
    while (cntr > 0 && max_num[i] + 1 < 10) {
      cntr--;
      max_num[i] += 1;
    }
  }
  for (int j = 0; j < m; j++) {
    answer[1] += to_string(max_num[j]);
  }
  return answer;
}
int main() {
  int m, s;
  cin >> m >> s;
  vector<string> res = solve(m, s);
  cout << res[0] << " " << res[1];
  return 0;
}
