#include <bits/stdc++.h>
using namespace std;
int a[107], b[107];
int main() {
  int m, s;
  cin >> m >> s;
  int ss = s;
  if (s >= 2 and s <= m * 9) {
    s--;
    a[m] = 1;
    for (int i = 1; i <= m; i++) {
      if (s > 9) {
        a[i] += 9;
        s -= 9;
      } else {
        a[i] += s;
        break;
      }
    }
    for (int i = m; i > 0; i--) {
      cout << a[i];
    }
    cout << ' ';
    for (int i = m; i > 0; i--) {
      if (ss > 9) {
        b[i] = 9;
        ss -= 9;
      } else {
        b[i] += ss;
        break;
      }
    }
    for (int i = m; i > 0; i--) {
      cout << b[i];
    }
  } else {
    if (s == 1) {
      cout << 1;
      for (int i = 1; i < m; i++) {
        cout << 0;
      }
      cout << ' ';
      cout << 1;
      for (int i = 1; i < m; i++) {
        cout << 0;
      }
    } else {
      if (m == 1 and s == 0) {
        cout << 0 << ' ' << 0;
      } else {
        cout << -1 << ' ' << -1;
      }
    }
  }
}
