#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
int a[MAXN];
int main() {
  int m, s;
  scanf("%d%d", &m, &s);
  if (m == 1 && s == 0) {
    puts("0 0");
    return 0;
  }
  if (s >= 1 && s <= m * 9) {
    int tmp = s - 1;
    a[1] = 1;
    for (int i = m; i >= 1 && tmp; i--) {
      while (a[i] < 9) {
        a[i]++;
        tmp--;
        if (tmp == 0) break;
      }
    }
    for (int i = 1; i <= m; i++) printf("%d", a[i]), a[i] = 0;
    printf(" ");
    tmp = s - 1;
    a[1] = 1;
    for (int i = 1; i <= m && tmp; i++) {
      while (a[i] < 9) {
        a[i]++;
        if (--tmp == 0) break;
      }
    }
    for (int i = 1; i <= m; i++) printf("%d", a[i]);
  } else
    puts("-1 -1");
  return 0;
}
