#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, sum;
  cin >> n >> m;
  string mn, mx;
  for (int i = 0; i < n; i++) {
    mx = mx + "9";
    if (i == 0)
      mn = mn + "1";
    else
      mn = mn + "0";
  }
  sum = 9 * n;
  int mnsum = 1, fgmn = 0, fgmx = 0;
  int k = n - 1;
  if (m > sum || (m < 1 && n > 1)) {
    fgmx = 1;
    fgmn = 1;
  }
  while (!fgmx && sum != m && k >= 0) {
    if (sum - m <= 9) {
      mx[k] = char(57 - sum + m);
      break;
    } else {
      mx[k] = 48;
      sum = sum - 9;
    }
    k--;
  }
  k = n - 1;
  while (!fgmn && m != mnsum) {
    if (m - mnsum > 9) {
      mn[k] = 57;
      mnsum += 9;
    } else {
      mn[k] = (mn[k] - 48) + 48 + m - mnsum;
      if (mn[k] > 57 || mn[k] < 48) fgmn = 1;
      break;
    }
    k--;
  }
  if (!fgmn)
    cout << mn << " ";
  else
    cout << "-1 ";
  if (!fgmx)
    cout << mx << " ";
  else
    cout << "-1 ";
}
