#include <bits/stdc++.h>
using namespace std;
int m, s;
int a[1000];
int main() {
  cin >> m >> s;
  if (m == 1 && s == 0) {
    cout << "0 0";
    return 0;
  }
  if (s <= 0 || s > 9 * m) {
    cout << "-1 -1";
    return 0;
  }
  for (int i = 0; i < m; i++) a[i] = 0;
  a[0] = 1;
  int sum = 1;
  int k = m - 1;
  while (1) {
    if (sum + 9 <= s) {
      sum += 9;
      a[k--] += 9;
    } else
      break;
  }
  int temp = -sum + s;
  a[k] += temp;
  int flag = 0;
  if (flag == 0) {
    for (int i = 0; i < m; i++) cout << a[i];
    cout << " ";
  }
  for (int i = 0; i < m; i++) a[i] = 9;
  sum = 9 * m;
  k = m - 1;
  while (1) {
    if (sum - 9 >= s) {
      sum -= 9;
      a[k--] -= 9;
    } else
      break;
  }
  temp = sum - s;
  a[k] -= temp;
  if (flag == 0) {
    for (int i = 0; i < m; i++) cout << a[i];
  }
  if (flag == 1) cout << "-1 -1 ";
  return 0;
}
