#include <bits/stdc++.h>
using namespace std;
int M, S;
int main() {
  scanf("%d %d", &M, &S);
  if (S == 0 && M == 1)
    puts("0 0");
  else if (S > M * 9 || S < 1)
    puts("-1 -1");
  else {
    int p;
    p = S;
    for (int Mi = M; Mi >= 1; Mi--) {
      int x;
      if (Mi == M)
        x = max(1, p - (Mi - 1) * 9);
      else
        x = max(0, p - (Mi - 1) * 9);
      printf("%d", x);
      p -= x;
    }
    printf(" ");
    p = S;
    for (int Mi = M; Mi >= 1; Mi--) {
      int x;
      x = min(9, p);
      printf("%d", x);
      p -= x;
    }
    puts("");
  }
}
