#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m, m1, arr[9] = {0}, num = 0, num1 = 0;
  cin >> n >> m, m1 = m;
  if (n == 1 && m == 0)
    cout << "0 0";
  else if (9 * n < m || m == 0)
    cout << "-1 -1";
  else {
    num1 = 1;
    while (m - (num1) > (n - 1) * 9) num1++;
    cout << num1;
    num += num1;
    num1 = 0;
    for (int i = 1; i < n; i++) {
      while (m - (num1 + num) > (n - (i + 1)) * 9) num1++;
      cout << num1;
      num += num1;
      num1 = 0;
    }
    num = 0;
    cout << ' ';
    for (int i = 8; i >= 0; i--) {
      arr[i] = m1 / (i + 1);
      m1 %= (i + 1);
      num += arr[i];
    }
    for (int i = 8; i >= 0; i--)
      while (arr[i]--) cout << i + 1;
    while (num < n) cout << '0', num++;
  }
  return 0;
}
