#include <bits/stdc++.h>
using namespace std;
int m, s, resDig, loneDig, loneDigSmall;
int main() {
  cin >> m >> s;
  if (s > m * 9 || s == 0) {
    if (m == 1 && s == 0)
      cout << "0 0" << endl;
    else
      cout << "-1 -1" << endl;
    return 0;
  }
  resDig = (s + 8) / 9;
  loneDig = s % 9;
  loneDig = loneDig ? loneDig : 9;
  loneDigSmall = loneDig;
  if (resDig < m) {
    loneDigSmall--;
  }
  for (int i = m; i > resDig; i--) {
    if (i == m)
      cout << 1;
    else
      cout << 0;
  }
  cout << loneDigSmall;
  for (int i = 1; i < resDig; i++) {
    cout << 9;
  }
  cout << " ";
  for (int i = 1; i < resDig; i++) {
    cout << 9;
  }
  cout << loneDig;
  for (int i = resDig; i < m; i++) {
    cout << 0;
  }
  cout << endl;
}
