#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, s;
  cin >> m >> s;
  int sum = s;
  int smallest[m], largest[m];
  if (s > 9 * m) {
    cout << "-1 -1\n";
    return 0;
  }
  if (m == 0 && s != 0) {
    cout << "-1 -1\n";
    return 0;
  }
  if (s == 0) {
    (m == 1) ? cout << "0 0\n" : cout << "-1 -1\n";
    return 0;
  }
  s = s - 1;
  for (int i = 0; i < m - 1; i++) {
    if (s > 9) {
      smallest[i] = 9;
      s = s - 9;
    } else {
      smallest[i] = s;
      s = 0;
    }
  }
  s = s + 1;
  smallest[m - 1] = s;
  for (int i = 0; i < m; i++) {
    if (sum > 9) {
      largest[i] = 9;
      sum = sum - 9;
    } else {
      largest[i] = sum;
      sum = 0;
    }
  }
  for (int i = m - 1; i >= 0; i--) cout << smallest[i];
  cout << " ";
  for (int i = 0; i < m; i++) cout << largest[i];
  return 0;
}
