#include <bits/stdc++.h>
using namespace std;
int mn[10005], mx[10005], m, s, i, t;
int main() {
  cin >> m >> s;
  if (9 * m < s or !s and m != 1) {
    cout << -1 << " " << -1;
    return 0;
  }
  if (s <= 9) {
    if (m == 1)
      mn[1] = s;
    else {
      mn[1] = 1;
      mn[m] = s - 1;
    }
    for (i = 1; i <= m; i++) {
      if (s >= 9)
        mx[i] = 9, s -= 9;
      else if (i == 1)
        mx[i] = s;
      else
        mx[i] = 0;
    }
  } else {
    mn[1] = 1, s--;
    int k = s + 1;
    for (i = m; i >= 1; i--) {
      if (s >= 9)
        mn[i] += 9, s -= 9;
      else
        mn[i] += s, s = 0;
    }
    for (i = 1; i <= m; i++) {
      if (k >= 9)
        mx[i] += 9, k -= 9;
      else
        mx[i] += k, k = 0;
    }
  }
  for (i = 1; i <= m; i++) cout << mn[i];
  cout << " ";
  for (i = 1; i <= m; i++) cout << mx[i];
  return 0;
}
