Here is my code:

```
int len = nums.length;
int[] res = new int[len];
k %= len;
for (int i = 0; i < k; i ++) {
res[i] = nums[len -k + i];
}
for (int i = 0; i < len - k; i ++) {
res[i+k] = nums[i];
}
nums = res;
```

I tested on my computer, it does return [2,1]. Why I submit on LeetCode it says that my answer is [1,2]??