Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given an integer array nums and an integer k, you are asked to construct the array ans of size n-k+1 where ans[i] is the number of distinct numbers in the subarray nums[i:i+k-1] = [nums[i], nums[i+1], ..., nums[i+k-1]].
Return the array ans.
 
Please complete the following python code precisely:
```python
class Solution:
    def distinctNumbers(self, nums: List[int], k: int) -> List[int]:
```