#include <bits/stdc++.h>
using namespace std;
int M, S, T, i, j;
string mins, maks;
int main() {
  cin >> M >> S;
  if (M == 1 && S < 10) {
    cout << S << " " << S << endl;
  } else if (9 * M < S || S < 1) {
    cout << -1 << " " << -1 << endl;
  } else {
    T = S;
    mins = (char)(max(1, T - 9 * (M - 1)) + (int)'0');
    T = T - (int)(mins[0] - '0');
    for (i = 2; i <= M; i++) {
      if (T > 9 * (M - i)) {
        mins = mins + (char)(T - 9 * (M - i) + (int)'0');
        T = 9 * (M - i);
      } else
        mins = mins + '0';
    }
    T = S;
    maks = "";
    for (i = 0; i < M; i++) {
      if (T > 9) {
        maks = maks + '9';
        T = T - 9;
      } else if (T > 0) {
        maks = maks + (char)(T + (int)'0');
        T = 0;
      } else
        maks = maks + '0';
    }
    cout << mins << " " << maks << endl;
  }
}
