#include <bits/stdc++.h>
using namespace std;
int dx8[8] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy8[8] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  file();
  int n, s;
  cin >> n >> s;
  if (n == 1 && s == 0) {
    cout << "0 0" << endl;
    return 0;
  }
  if (n * 9 < s || s == 0) {
    cout << "-1 -1" << endl;
    return 0;
  }
  int sum = s;
  vector<int> mx, mn;
  for (int i = 0; i < n; i++) {
    if (sum >= 9)
      mx.push_back(9), sum -= 9;
    else
      mx.push_back(sum), sum = 0;
  }
  sum = s;
  for (int i = n - 1; i > 0; i--) {
    mn.push_back(min(sum - 1, 9));
    sum -= min(sum - 1, 9);
  }
  mn.push_back(sum);
  reverse(((mn).begin()), ((mn).end()));
  int zeros = n - mn.size();
  for (int i = 0; i < mn.size(); i++) {
    cout << mn[i];
    if (i == 0) {
      for (int j = 0; j < zeros; j++) cout << 0;
    }
  }
  cout << " ";
  for (int i = 0; i < n; i++) cout << mx[i];
  cout << endl;
}
