#include <bits/stdc++.h>
using namespace std;
int high[105];
int temp[105];
int low[105];
int times;
void maxpo(int freq, int key) {
  int ans = 0, cont = 0;
  while (key > 9) {
    high[cont] = 9;
    key -= 9;
    cont++;
  }
  high[cont] = key;
  cont++;
  while (cont < freq) {
    high[cont] = 0;
    cont++;
  }
  times = cont;
}
void lowpi(int k) {
  for (int i = k; i >= 0; i--) cout << high[i];
  cout << " ";
}
int main() {
  int n, m;
  cin >> n;
  cin >> m;
  if (n == 1 && m == 0) {
    cout << "0 0" << endl;
    return 0;
  }
  maxpo(n, m);
  if (high[0] == 0 || times != n) {
    cout << "-1 -1" << endl;
    return 0;
  }
  if (high[n - 1] == 0) {
    maxpo(n - 1, m - 1);
    cout << 1;
    lowpi(n - 2);
  } else {
    lowpi(n - 1);
  }
  maxpo(n, m);
  for (int i = 0; i < n; i++) {
    cout << high[i];
  }
  return 0;
}
