#include <bits/stdc++.h>
using namespace std;
string ansmin, ansmax;
int sum, n;
int main() {
  cin.tie(0), ios_base ::sync_with_stdio(0);
  cin >> n >> sum;
  if (n * 9 < sum || (1 > sum && n != 1)) {
    cout << "-1 -1";
    return 0;
  }
  if (n == 1) {
    cout << sum << " " << sum;
    return 0;
  }
  int x = sum;
  for (int i = 1; i <= n; i++) {
    if (x >= 9)
      ansmax += '9', x -= 9;
    else if (x > 0)
      ansmax += x + '0', x = 0;
    else
      ansmax += '0';
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = (i == n - 1); j <= 9; j++) {
      int cur = sum - j;
      if (cur >= 0 && cur <= i * 9) {
        ansmin += (j + '0');
        sum -= j;
        break;
      }
    }
  }
  cout << ansmin << " " << ansmax;
  return 0;
}
