#include <bits/stdc++.h>
using namespace std;
vector<long long int> small;
vector<long long int> large;
long long int largest(long long int digits, long long int sum) {
  long long int i;
  if (digits == 0) return sum;
  for (i = 9; i >= 0; i--) {
    if (sum >= i) {
      large.push_back(i);
      sum = sum - i;
      break;
    }
  }
  return largest(digits - 1, sum);
}
long long int smallest(long long int digits, long long int sum) {
  long long int i;
  if (digits == 0) return sum;
  for (i = 0; i <= 9; i++) {
    if (sum >= i && ((sum - i) <= 9 * (digits - 1))) {
      small.push_back(i);
      sum = sum - i;
      break;
    }
  }
  return smallest(digits - 1, sum);
}
int main() {
  long long int i, j, t, n, m, temp, sum1, sum;
  cin >> n >> sum;
  sum1 = sum;
  for (i = 1; i <= 9; i++) {
    if (sum >= i && ((sum - i) <= 9 * (n - 1))) {
      small.push_back(i);
      sum = sum - i;
      break;
    }
  }
  temp = smallest(n - 1, sum);
  if (temp > 0 || sum1 == 0) {
    if (sum1 == 0 && n == 1)
      cout << 0 << " ";
    else
      cout << -1 << " ";
  } else {
    for (i = 0; i < small.size(); i++) cout << small[i];
    cout << " ";
  }
  temp = largest(n, sum1);
  if (temp > 0 || sum1 == 0) {
    if (sum1 == 0 && n == 1)
      cout << 0 << endl;
    else
      cout << -1 << endl;
  } else {
    for (i = 0; i < large.size(); i++) cout << large[i];
    cout << endl;
  }
  return 0;
}
