#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {-1, 0, 0, 1};
const long long dy[] = {0, -1, 1, 0};
const int Mass = (int)2e5 + 5;
const int inf = (int)1e9 + 5;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  int len, sum;
  string s = "";
  cin >> len >> sum;
  if (sum == 0 && len == 1) {
    cout << "0 0";
    return 0;
  }
  if (sum == 0) {
    cout << -1 << ' ' << -1;
    return 0;
  }
  for (int i = 1; i <= len; ++i) {
    if (sum >= 9) {
      s += '9';
      sum -= 9;
    } else {
      s += (sum + '0');
      sum = 0;
    }
  }
  if (sum != 0) {
    cout << -1 << ' ' << -1;
    return 0;
  }
  string mn = s;
  reverse(s.begin(), s.end());
  for (int i = 0; i < len; ++i) {
    if (s[i] != '0') {
      s[i]--;
      break;
    }
  }
  s[0]++;
  cout << s << ' ' << mn;
  return 0;
}
