#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) { return a > b ? b : a; }
int max(int a, int b) { return a < b ? b : a; }
int n, m, s;
int main() {
  cin >> m >> s;
  bool d[102][902];
  for (int i = 0; i < 102; i++) {
    for (int j = 0; j < 902; j++) {
      d[i][j] = false;
    }
  }
  d[0][0] = true;
  for (int i = 1; i <= m; i++) {
    for (int j = 0; j <= s; j++) {
      for (int p = 0; p < 10; p++) {
        if (j < p) {
          break;
        }
        d[i][j] |= d[i - 1][j - p];
      }
    }
  }
  bool exists = false;
  for (int p = 1; p < 10; p++) {
    if (d[m - 1][s - p]) {
      exists = true;
      break;
    }
  }
  if (m == 1 && s == 0) {
    cout << "0 0\n";
    return 0;
  }
  if (!exists) {
    cout << -1 << " " << -1 << endl;
    return 0;
  }
  int temp = s;
  for (int i = 1; i <= m; i++) {
    for (int j = (i == 1 ? 1 : 0); j < 10; j++) {
      if (d[m - i][s - j]) {
        cout << j;
        s -= j;
        break;
      }
    }
  }
  cout << endl;
  s = temp;
  for (int i = 1; i <= m; i++) {
    for (int j = 9; j >= (i == 1 ? 1 : 0); j--) {
      if (d[m - i][s - j]) {
        cout << j;
        s -= j;
        break;
      }
    }
  }
  cout << endl;
  return 0;
}
