#include <bits/stdc++.h>
using namespace std;
int maxim[10000], minim[10000], n, sum;
int formeaza_maxim() {
  int i = 1;
  if (n * 9 < sum) return -1;
  if (sum == 0) return -1;
  while (sum > 0) {
    while (sum > 8) {
      maxim[i] = 9;
      sum -= 9;
      ++i;
    }
    maxim[i] = sum;
    sum = 0;
  }
  return 0;
}
void formeaza_minim() {
  int i;
  for (i = n; i > 0; --i) minim[n - i + 1] = maxim[i];
  if (minim[1] == 0) {
    minim[1] = 1;
    i = 2;
    while (minim[i] == 0 && i <= n) ++i;
    --minim[i];
  }
}
void afiseaza(int v[], int n) {
  for (int i = 1; i <= n; ++i) cout << v[i];
  cout << " ";
}
int main() {
  cin >> n >> sum;
  if (sum == 0 && n != 1) cout << "-1 -1" << endl;
  if (n * 9 < sum) cout << "-1 -1" << endl;
  if (sum == 0 && n == 1) cout << "0 0" << endl;
  int se_poate = formeaza_maxim();
  formeaza_minim();
  if (se_poate == 0) afiseaza(minim, n), afiseaza(maxim, n);
  return 0;
}
