#include <bits/stdc++.h>
using namespace std;
void findSmallest(int m, int s) {
  if (s == 0) {
    (m == 1) ? cout << 0 : cout << "-1";
    return;
  }
  if (s > 9 * m) {
    cout << "-1";
    return;
  }
  s--;
  int r[m];
  for (int i = m - 1; i > 0; i--) {
    if (s > 9) {
      r[i] = 9;
      s -= 9;
    } else {
      r[i] = s;
      s = 0;
    }
  }
  r[0] = s + 1;
  for (int i = 0; i < m; i++) cout << r[i];
}
void findLargest(int m, int s) {
  if (s == 0) {
    (m == 1) ? cout << 0 : cout << "-1";
    return;
  }
  if (s > 9 * m) {
    cout << "-1";
    return;
  }
  for (int i = 0; i < m; i++) {
    if (s >= 9) {
      cout << 9;
      s -= 9;
    } else {
      cout << s;
      s = 0;
    }
  }
}
int main() {
  int s, m;
  cin >> m >> s;
  findSmallest(m, s);
  cout << " ";
  findLargest(m, s);
  return 0;
}
