Straight Line to Text Input:

2 numbers, x and y.

Output:

Output a text block where x is the width of the text block and y is the height of the text block. Then there will be a straight line going from the top left to the bottom right and to show it, there should be a # where the line should cross.

The # should be generated using the straight line equation, y = mx + c where m is the gradient of the line which can be retrieved through making m as y divided by x. x is the current line index. c is the height intercept and can be found by multiplying the gradient by the x value and adding the y value. So, in short, it would be (y/x) * lineIndex + (y/x * x + h). This would all be rounded to the nearest position in the current line.

Rules:


there can only be 1 # per line
it has to be in the form of a string/whatever the equivalent in your language of choice. This has to be able to cover multiple lines as well.
in text block, after the # there does not need to be more spaces. Just initial ones to offset the #


Examples:

(don't mind the |, they are where the lines start and stop)

Where x is 9 and y is 1:

|        #|


Where x is 1 and y is 5:

|#|
|#|
|#|
|#|
|#|


where x is 9 and y is 5:

| #       |
|   #     |
|    #    |
|      #  |
|        #|


where x is 5 and y is 9:

|#    |
|#    |
| #   |
| #   |
|  #  |
|  #  |
|   # |
|   # |
|    #|


where x is 9 and y is 2:

|   #     |
|        #|


where x is 9 and y is 3:

|  #      |
|     #   |
|        #|


Edit: More detail in the output. Added 3rd rule. Added 5th and 6th example

Edit2: Fixed errors in the given examples (Sorry!). Revised over the output to make it much clearer v. sorry for any confusion :S
C, 74 70 bytes

Thanks to @Johan du Toit for saving 4 bytes!

i;f(x,y){for(i=y;i--;)printf("%*c\n",(int)round((i-y)/(-1.*y/x)),35);}


Try it online!